package com.git.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.git.domain.AjaxEntity;
import com.git.domain.StudentEntity;
import com.git.service.StudentService;

@Controller
@RequestMapping("studentController")
public class StudentController {
	@Autowired
	private StudentService studentService;

	@RequestMapping(value = "add", method = RequestMethod.POST)
	public ResponseEntity<AjaxEntity> add(StudentEntity studentEntity) {
		try {
			AjaxEntity ajaxEntity = this.studentService.add(studentEntity);
			return ResponseEntity.status(200).body(ajaxEntity);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return ResponseEntity.status(500).body(new AjaxEntity(false, "服务器报错"));
	}

}
